#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/7/22 19:29
# @Author  : 王凯
# @File    : main_run.py
# @Project : scrapy_spider
import sys
from pathlib import Path

from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings

sys.path.append(Path(__file__).parent.parent.parent.parent.as_posix())
from components.settings.private.net_robot_mysql_settings import *

if __name__ == '__main__':
    settings = get_project_settings()
    os.environ['MYSQL_IP'] = MYSQL_IP
    os.environ['MYSQL_PORT'] = MYSQL_PORT
    os.environ['MYSQL_DB'] = MYSQL_DB
    os.environ['MYSQL_USER_NAME'] = MYSQL_USER_NAME
    os.environ['MYSQL_USER_PASS'] = MYSQL_USER_PASS
    process = CrawlerProcess(settings)
    spider_list = [
        'siku_search',
    ]
    for spider in spider_list:
        process.crawl(spider)
    process.start()
